<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var num = 0;
        function add() {
            num = num + 1;
        }
        function showNum() {
            while(num<5){
                add();
                document.write(num);
            }
        }
        showNum();
    </script>
</head>
<body>
    
</body>
</html>
